import React, { Component, useContext } from "react";
import ReactDOM from "react-dom";
import {
  useSelector as useSelectorRaw,
} from "react-redux";
import {
  HashRouter as Router,
  Link,
  Route,
  BrowserRouter,
} from "react-router-dom";

import {
  MyContext
} from "./store";

function Home(props) {
  console.log(props)

  const xxx = useContext(MyContext) // 
  const count = useSelectorRaw(state => state.count) // 全局的

  return (
    <div>
      <ul className="menu">
        <li>
          <Link to="/Home">home</Link>
        </li>
      </ul>

      <div>全局的 count: {count}</div>


      <MyContext.Consumer>
        {(props) => {
          console.log('consumer props', props);
          return <div>from consumer</div>;
        }}
      </MyContext.Consumer>
    </div>
  );
}
export default Home;
